package com.ruyuan.dependency.product.service.impl;

import com.ruyuan.dependency.product.entity.Spu;
import com.ruyuan.dependency.product.mapper.SpuMapper;
import com.ruyuan.dependency.product.service.SpuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
 * @author zhonghuashishan
 */
@Service
public class SpuServiceImpl implements SpuService {

    @Autowired
    private SpuMapper spuMapper;

    @Override
    public Spu queryById(Long spuId) {
        return spuMapper.selectById(spuId);
    }

    @Override
    public void save(Spu spu) {
        spu.setCreateTime(new Date());
        spu.setUpdateTime(spu.getCreateTime());
        spuMapper.insert(spu);
    }
}